<%
    if(session.getAttribute("currentSessionUser") == null){
        response.sendRedirect("index.jsp?redirect=true");
    }else{
%>
<%@ include file="WEB-INF/jspf/headerLogin.jspf" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%>
<h3>Admin Control Panel</h3>
<a href="index.jsp?logout=true" style="float: right; padding-right: 2.5%; ">Logout</a>


<br/><br/><p style="padding-left: 15px">Locked Users</p>
<sql:query var="result" dataSource="jdbc/CS2340SeedSwap">
    SELECT sr_no, uname, password,firstName,lastName,email,consecutiveFails FROM users 
    WHERE isLocked=true
</sql:query>
<div class="formDiv">
<form name="actionForm" action="AdminServlet" method="POST">
    <table border="1">
        <!-- column headers -->
        <tr>
                <th>Unlock</th>
                <th>ID</th>
                <th>Username</th>
                <th>Password</th>
                <th>First Name</th>
                <th>Last Name</th>
                <th>Email</th>
                <th>Consecutive Fails</th>
        </tr>
        <!-- column data -->
        <c:forEach var="row" items="${result.rowsByIndex}">
            <tr>
                <td>
                    <input type="checkbox" name="rowid[]" value="${row[1]}" />
                </td>
                
                <c:forEach var="column" items="${row}">
                    <td><c:out value="${column}"/></td>
                </c:forEach>
            </tr>
        </c:forEach>
    </table>
    <input type="submit" value="submit"></input>
</form>
</div>
<%@ include file="WEB-INF/jspf/footerLogin.jspf" %>
<% }%>